Su Xin Ke Ji
  • Home
  • Archives
  • Tags
  • Categories
  • 中文

Gitee Multiple User - Thu, Apr 20, 2023

Go to the .ssh directory

c:
cd c:\Users\xxx\.ssh

Generate ssh key

input any email

ssh-keygen -t ed25519 -C "[email protected]"

You can enter the key name at the first prompt, press enter twice, and then copy the. pub content to the public key configuration of gitee.

Add ssh configuration

Create a new config file in the .ssh directory with the following contents (suitable for multi-users)

# gitee user1
Host gitee_user1
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/user1_rsa
User user1

# gitee user2
Host gitee_user2
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/user2_rsa
User user2

Test ssh connection

$ ssh -T git@gitee_user1
$ ssh -T git@gitee_user2

Clone the repository

git clone git@gitee_user1:Replace the corresponding content here/xxx.git

Note here that it must be written as git@gitee_user1, where gitee_user1 is the Host field in .ssh / config.

Go to repository directory,set user and email for git

cd xxx
git config --local user.name "user1"
git config --local user.email "[email protected]"

Back to Home


蒙ICP备2023001205号-2 | © 素心科技 2025